@ GNU AS assembler header file for DrawFile
@ Written by DefMod (Dec  9 2012) on Sun Dec  9 15:50:43 2012
@ Jonathan Coxhead, jonathan@doves.demon.co.uk, 21 Aug 1995

@ OSLib---efficient, type-safe, transparent, extensible,
@ register-safe API coverage of RISC OS
@ 
@ Copyright (c) 1994-2012 Jonathan Coxhead and OSLib maintainers
@ 
@ Licence:
@ 
@    OSLib is free software; you can redistribute it and/or modify
@ it under the terms of the GNU General Public License as published by
@ the Free Software Foundation; either version 1, or (at your option)
@ any later version - and this with the following clarification and
@ special exception:
@ 
@    Linking this library statically or dynamically with other modules
@ is making a combined work based on this library. Thus, the terms
@ and conditions of the GNU General Public License cover the whole
@ combination.
@ 
@    As a special exception, the copyright holders of this library
@ give you permission to link this library with independent modules
@ to produce an executable, regardless of the license terms of these
@ independent modules, and to copy and distribute the resulting
@ executable under terms of your choice, provided that you also meet,
@ for each linked independent module, the terms and conditions of the
@ license of that module. An independent module is a module which is
@ not derived from or based on this library. If you modify this
@ library, you may extend this exception to your version of the library,
@ but you are not obliged to do so. If you do not wish to do so, delete
@ this exception statement from your version.
@ 
@    OSLib is distributed in the hope that it will be useful,
@ but WITHOUT ANY WARRANTY; without even the implied warranty of
@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@ GNU General Public License for more details.
@ 
@    You should have received a copy of the GNU General Public License
@ along with this programme; if not, write to the Free Software
@ Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, USA.

#ifndef DrawFile_Hdr
#  define DrawFile_Hdr

#  ifndef Get_Types
#    define Get_Types
#    include "oslib/Types.Hdr"
#  endif

#  ifndef Get_OS
#    define Get_OS
#    include "oslib/OS.Hdr"
#  endif

#  ifndef Get_OSSpriteOp
#    define Get_OSSpriteOp
#    include "oslib/OSSpriteOp.Hdr"
#  endif

#  ifndef Get_Draw
#    define Get_Draw
#    include "oslib/Draw.Hdr"
#  endif

#  ifndef Get_Font
#    define Get_Font
#    include "oslib/Font.Hdr"
#  endif

#  ifndef Get_Wimp
#    define Get_Wimp
#    include "oslib/Wimp.Hdr"
#  endif

#  ifndef Get_JPEG
#    define Get_JPEG
#    include "oslib/JPEG.Hdr"
#  endif

@Symbols for constants
#  define Error_DrawFileNotDraw 0x20c00
#  define Error_DrawFileVersion 0x20c01
#  define Error_DrawFileFontTab 0x20c02
#  define Error_DrawFileBadFontNo 0x20c03
#  define Error_DrawFileBadMode 0x20c04
#  define Error_DrawFileBadFile 0x20c05
#  define Error_DrawFileBadGroup 0x20c06
#  define Error_DrawFileBadTag 0x20c07
#  define Error_DrawFileSyntax 0x20c08
#  define Error_DrawFileFontNo 0x20c09
#  define Error_DrawFileAreaVer 0x20c0a
#  define Error_DrawFileNoAreaVer 0x20c0b
#  define DrawFile_TypeFontTable 0x0
#  define DrawFile_TypeText 0x1
#  define DrawFile_TypePath 0x2
#  define DrawFile_TypeSprite 0x5
#  define DrawFile_TypeGroup 0x6
#  define DrawFile_TypeTagged 0x7
#  define DrawFile_TypeTextArea 0x9
#  define DrawFile_TypeTextColumn 0xa
#  define DrawFile_TypeOptions 0xb
#  define DrawFile_TypeTrfmText 0xc
#  define DrawFile_TypeTrfmSprite 0xd
#  define DrawFile_TypeJPEG 0x10
#  define DrawFile_PathMitred 0x0
#  define DrawFile_PathRound 0x1
#  define DrawFile_PathBevelled 0x2
#  define DrawFile_PathButt 0x0
#  define DrawFile_PathSquare 0x2
#  define DrawFile_PathTriangle 0x3
#  define DrawFile_PathJoinShift 0x0
#  define DrawFile_PathJoin 0x3
#  define DrawFile_PathEndShift 0x2
#  define DrawFile_PathEnd 0xc
#  define DrawFile_PathStartShift 0x4
#  define DrawFile_PathStart 0x30
#  define DrawFile_PathWindingEvenOdd 0x40
#  define DrawFile_PathDashed 0x80
#  define DrawFile_PathCapWidthShift 0x10
#  define DrawFile_PathCapWidth 0xff0000
#  define DrawFile_PathCapLengthShift 0x18
#  define DrawFile_PathCapLength 0xff000000
#  define DrawFile_TextKern 0x1
#  define DrawFile_TextRightToLeft 0x2
#  define DrawFile_TextUnderline 0x4
#  define DrawFile_RenderBBoxes 0x1
#  define DrawFile_RenderSuppress 0x2
#  define DrawFile_RenderGivenFlatness 0x4
#  define DrawFile_RenderGivenColourMapping 0x8
#  define DrawFile_NoDownload 0x1
#  define DrawFile_PaperShow 0x1
#  define DrawFile_PaperLandscape 0x10
#  define DrawFile_PaperDefault 0x100
#  define DrawFile_EntryModeLine 0x1
#  define DrawFile_EntryModeClosedLine 0x2
#  define DrawFile_EntryModeCurve 0x4
#  define DrawFile_EntryModeClosedCurve 0x8
#  define DrawFile_EntryModeRectangle 0x10
#  define DrawFile_EntryModeEllipse 0x20
#  define DrawFile_EntryModeTextLine 0x40
#  define DrawFile_EntryModeSelect 0x80

@Symbols for structure offsets and sizes
        .struct 0
        .skip   Int
DrawFile_Type                  : 

        .struct 0
        .skip   Byte
DrawFile_PathStyleFlags        : 

        .struct 0
        .skip   Bits
DrawFile_TextFlags             : 

        .struct 0
        .skip   Bits
DrawFile_RenderFlags           : 

        .struct 0
        .skip   Bits
DrawFile_DeclareFontsFlags     : 

        .struct 0
        .skip   Bits
DrawFile_PaperOptions          : 

        .struct 0
        .skip   Bits
DrawFile_EntryMode             : 

        .struct 0
DrawFile_FontDef_font_index    : .skip   Byte
DrawFile_FontDef_font_name     : .skip   Char
DrawFile_FontDef               : 
        
        .altmacro
        .macro  DrawFile_FontDef_MEMBERS label
\label&_font_index             : .skip   Byte
        .endm
        
        .struct 0
        DrawFile_FontDef_MEMBERS DrawFile_FontDefBase
DrawFile_FontDefBase           : 

        .struct 0
DrawFile_TextStyle_font_index  : .skip   Byte
DrawFile_TextStyle_reserved    : .skip   3*Byte
DrawFile_TextStyle             : 

        .struct 0
DrawFile_PathStyle_flags       : .skip   DrawFile_PathStyleFlags
DrawFile_PathStyle_reserved    : .skip   Byte
DrawFile_PathStyle_cap_width   : .skip   Byte
DrawFile_PathStyle_cap_length  : .skip   Byte
DrawFile_PathStyle             : 

        .struct 0
DrawFile_FontTable_font_def    : .skip   DrawFile_FontDef
DrawFile_FontTable             : 

        .struct 0
DrawFile_Text_bbox             : .skip   OS_Box
DrawFile_Text_fill             : .skip   OS_Colour
DrawFile_Text_bg_hint          : .skip   OS_Colour
DrawFile_Text_style            : .skip   DrawFile_TextStyle
DrawFile_Text_xsize            : .skip   Int
DrawFile_Text_ysize            : .skip   Int
DrawFile_Text_base             : .skip   OS_Coord
DrawFile_Text_text             : .skip   Char
DrawFile_Text                  : 
        
        .altmacro
        .macro  DrawFile_Text_MEMBERS label
\label&_bbox                   : .skip   OS_Box
\label&_fill                   : .skip   OS_Colour
\label&_bg_hint                : .skip   OS_Colour
\label&_style                  : .skip   DrawFile_TextStyle
\label&_xsize                  : .skip   Int
\label&_ysize                  : .skip   Int
\label&_base                   : .skip   OS_Coord
        .endm
        
        .struct 0
        DrawFile_Text_MEMBERS DrawFile_TextBase
DrawFile_TextBase              : 

        .struct 0
DrawFile_Path_bbox             : .skip   OS_Box
DrawFile_Path_fill             : .skip   OS_Colour
DrawFile_Path_outline          : .skip   OS_Colour
DrawFile_Path_width            : .skip   Int
DrawFile_Path_style            : .skip   DrawFile_PathStyle
DrawFile_Path_path             : .skip   Draw_Path
DrawFile_Path                  : 

        .struct 0
DrawFile_PathWithPattern_bbox  : .skip   OS_Box
DrawFile_PathWithPattern_fill  : .skip   OS_Colour
DrawFile_PathWithPattern_outline: .skip   OS_Colour
DrawFile_PathWithPattern_width : .skip   Int
DrawFile_PathWithPattern_style : .skip   DrawFile_PathStyle
DrawFile_PathWithPattern_pattern: .skip   Draw_DashPattern
DrawFile_PathWithPattern_path  : .skip   Draw_Path
DrawFile_PathWithPattern       : 

        .struct 0
DrawFile_Sprite_bbox           : .skip   OS_Box
DrawFile_Sprite_header         : .skip   OSSpriteOp_Header
DrawFile_Sprite_data           : .skip   Byte
DrawFile_Sprite                : 
        
        .altmacro
        .macro  DrawFile_Sprite_MEMBERS label
\label&_bbox                   : .skip   OS_Box
\label&_header                 : .skip   OSSpriteOp_Header
        .endm
        
        .struct 0
        DrawFile_Sprite_MEMBERS DrawFile_SpriteBase
DrawFile_SpriteBase            : 

        .struct 0
DrawFile_Group_bbox            : .skip   OS_Box
DrawFile_Group_name            : .skip   12*Char
DrawFile_Group_objects         : .skip   Int
DrawFile_Group                 : 
        
        .altmacro
        .macro  DrawFile_Group_MEMBERS label
\label&_bbox                   : .skip   OS_Box
\label&_name                   : .skip   12*Char
        .endm
        
        .struct 0
        DrawFile_Group_MEMBERS DrawFile_GroupBase
DrawFile_GroupBase             : 

        .struct 0
DrawFile_Tagged_bbox           : .skip   OS_Box
DrawFile_Tagged_tag            : .skip   DrawFile_Type
DrawFile_Tagged_object         : .skip   Int
DrawFile_Tagged                : 
        
        .altmacro
        .macro  DrawFile_Tagged_MEMBERS label
\label&_bbox                   : .skip   OS_Box
\label&_tag                    : .skip   DrawFile_Type
        .endm
        
        .struct 0
        DrawFile_Tagged_MEMBERS DrawFile_TaggedBase
DrawFile_TaggedBase            : 

        .struct 0
DrawFile_TextColumn_box        : .skip   OS_Box
DrawFile_TextColumn            : 

        .struct 0
DrawFile_TextColumnList_columns_type: .skip   DrawFile_Type
DrawFile_TextColumnList_columns_size: .skip   Int
DrawFile_TextColumnList_columns_data: .skip   DrawFile_TextColumn
DrawFile_TextColumnList        : 

        .struct 0
DrawFile_AreaText_type         : .skip   DrawFile_Type
DrawFile_AreaText_reserved     : .skip   2*Int
DrawFile_AreaText_fill         : .skip   OS_Colour
DrawFile_AreaText_bg_hint      : .skip   OS_Colour
DrawFile_AreaText_text         : .skip   Char
DrawFile_AreaText              : 
        
        .altmacro
        .macro  DrawFile_AreaText_MEMBERS label
\label&_type                   : .skip   DrawFile_Type
\label&_reserved               : .skip   2*Int
\label&_fill                   : .skip   OS_Colour
\label&_bg_hint                : .skip   OS_Colour
        .endm
        
        .struct 0
        DrawFile_AreaText_MEMBERS DrawFile_AreaTextBase
DrawFile_AreaTextBase          : 

        .struct 0
DrawFile_TextArea_bbox         : .skip   OS_Box
DrawFile_TextArea_header       : .skip   DrawFile_TextColumnList
DrawFile_TextArea_area_text    : .skip   DrawFile_AreaText
DrawFile_TextArea              : 

        .struct 0
DrawFile_Options_bbox          : .skip   OS_Box
DrawFile_Options_paper_size    : .skip   Int
DrawFile_Options_paper_options : .skip   DrawFile_PaperOptions
DrawFile_Options_grid_spacing  : .skip   Double
DrawFile_Options_grid_division : .skip   Int
DrawFile_Options_isometric     : .skip   Bool
DrawFile_Options_auto_adjust   : .skip   Bool
DrawFile_Options_show          : .skip   Bool
DrawFile_Options_lock          : .skip   Bool
DrawFile_Options_cm            : .skip   Bool
DrawFile_Options_zoom_mul      : .skip   Int
DrawFile_Options_zoom_div      : .skip   Int
DrawFile_Options_zoom_lock     : .skip   Bool
DrawFile_Options_toolbox       : .skip   Bool
DrawFile_Options_entry_mode    : .skip   DrawFile_EntryMode
DrawFile_Options_undo_size     : .skip   Int
DrawFile_Options               : 

        .struct 0
DrawFile_TrfmText_bbox         : .skip   OS_Box
DrawFile_TrfmText_trfm         : .skip   OS_Trfm
DrawFile_TrfmText_flags        : .skip   DrawFile_TextFlags
DrawFile_TrfmText_fill         : .skip   OS_Colour
DrawFile_TrfmText_bg_hint      : .skip   OS_Colour
DrawFile_TrfmText_style        : .skip   DrawFile_TextStyle
DrawFile_TrfmText_xsize        : .skip   Int
DrawFile_TrfmText_ysize        : .skip   Int
DrawFile_TrfmText_base         : .skip   OS_Coord
DrawFile_TrfmText_text         : .skip   Char
DrawFile_TrfmText              : 
        
        .altmacro
        .macro  DrawFile_TrfmText_MEMBERS label
\label&_bbox                   : .skip   OS_Box
\label&_trfm                   : .skip   OS_Trfm
\label&_flags                  : .skip   DrawFile_TextFlags
\label&_fill                   : .skip   OS_Colour
\label&_bg_hint                : .skip   OS_Colour
\label&_style                  : .skip   DrawFile_TextStyle
\label&_xsize                  : .skip   Int
\label&_ysize                  : .skip   Int
\label&_base                   : .skip   OS_Coord
        .endm
        
        .struct 0
        DrawFile_TrfmText_MEMBERS DrawFile_TrfmTextBase
DrawFile_TrfmTextBase          : 

        .struct 0
DrawFile_TrfmSprite_bbox       : .skip   OS_Box
DrawFile_TrfmSprite_trfm       : .skip   OS_Trfm
DrawFile_TrfmSprite_header     : .skip   OSSpriteOp_Header
DrawFile_TrfmSprite_data       : .skip   Byte
DrawFile_TrfmSprite            : 
        
        .altmacro
        .macro  DrawFile_TrfmSprite_MEMBERS label
\label&_bbox                   : .skip   OS_Box
\label&_trfm                   : .skip   OS_Trfm
\label&_header                 : .skip   OSSpriteOp_Header
        .endm
        
        .struct 0
        DrawFile_TrfmSprite_MEMBERS DrawFile_TrfmSpriteBase
DrawFile_TrfmSpriteBase        : 

        .struct 0
DrawFile_JPEG_bbox             : .skip   OS_Box
DrawFile_JPEG_width            : .skip   Int
DrawFile_JPEG_height           : .skip   Int
DrawFile_JPEG_xdpi             : .skip   Int
DrawFile_JPEG_ydpi             : .skip   Int
DrawFile_JPEG_trfm             : .skip   OS_Trfm
DrawFile_JPEG_len              : .skip   Int
DrawFile_JPEG_image            : .skip   JPEG_Image
DrawFile_JPEG                  : 

        .struct 0
DrawFile_Object_type           : .skip   DrawFile_Type
DrawFile_Object_size           : .skip   Int
DrawFile_Object_data           : 
DrawFile_Object_data_font_table: .skip   DrawFile_FontTable
        .struct DrawFile_Object_data
DrawFile_Object_data_text      : .skip   DrawFile_Text
        .struct DrawFile_Object_data
DrawFile_Object_data_path      : .skip   DrawFile_Path
        .struct DrawFile_Object_data
DrawFile_Object_data_path_with_pattern: .skip   DrawFile_PathWithPattern
        .struct DrawFile_Object_data
DrawFile_Object_data_sprite    : .skip   DrawFile_Sprite
        .struct DrawFile_Object_data
DrawFile_Object_data_group     : .skip   DrawFile_Group
        .struct DrawFile_Object_data
DrawFile_Object_data_tagged    : .skip   DrawFile_Tagged
        .struct DrawFile_Object_data
DrawFile_Object_data_text_column: .skip   DrawFile_TextColumn
        .struct DrawFile_Object_data
DrawFile_Object_data_text_area : .skip   DrawFile_TextArea
        .struct DrawFile_Object_data
DrawFile_Object_data_options   : .skip   DrawFile_Options
        .struct DrawFile_Object_data
DrawFile_Object_data_trfm_text : .skip   DrawFile_TrfmText
        .struct DrawFile_Object_data
DrawFile_Object_data_trfm_sprite: .skip   DrawFile_TrfmSprite
        .struct DrawFile_Object_data
DrawFile_Object_data_jpeg      : .skip   DrawFile_JPEG
DrawFile_Object                : 

        .struct 0
DrawFile_Diagram_tag           : .skip   4*Char
DrawFile_Diagram_major_version : .skip   Int
DrawFile_Diagram_minor_version : .skip   Int
DrawFile_Diagram_source        : .skip   12*Char
DrawFile_Diagram_bbox          : .skip   OS_Box
DrawFile_Diagram_objects       : .skip   DrawFile_Object
DrawFile_Diagram               : 
        
        .altmacro
        .macro  DrawFile_Diagram_MEMBERS label
\label&_tag                    : .skip   4*Char
\label&_major_version          : .skip   Int
\label&_minor_version          : .skip   Int
\label&_source                 : .skip   12*Char
\label&_bbox                   : .skip   OS_Box
        .endm
        
        .struct 0
        DrawFile_Diagram_MEMBERS DrawFile_DiagramBase
DrawFile_DiagramBase           : 

        .struct 0
        .skip   Bits
DrawFile_BBoxFlags             : 

        .struct 0
DrawFile_RenderState_object    : .skip   Ptr
DrawFile_RenderState_diagram   : .skip   Ptr
DrawFile_RenderState_font_table: .skip   Ptr
DrawFile_RenderState_flags     : .skip   DrawFile_RenderFlags
DrawFile_RenderState_trfm      : .skip   Ptr
DrawFile_RenderState_clip      : .skip   Ptr
DrawFile_RenderState_flatness  : .skip   Int
DrawFile_RenderState_error     : .skip   Ptr
DrawFile_RenderState_mapping   : .skip   Ptr
DrawFile_RenderState           : 

        .struct 0
DrawFile_DeclareFontsState_object: .skip   Ptr
DrawFile_DeclareFontsState_diagram: .skip   Ptr
DrawFile_DeclareFontsState_font_table: .skip   Ptr
DrawFile_DeclareFontsState_flags: .skip   DrawFile_DeclareFontsFlags
DrawFile_DeclareFontsState_error: .skip   Ptr
DrawFile_DeclareFontsState     : 


@Symbols for SWI's and SWI reason codes
.set XDrawFile_Render,0x65540
.set DrawFile_Render,0x45540
   @Entry
   @  R0 = flags (DrawFile_RenderFlags)
   @  R1 -> diagram (DrawFile_Diagram)
   @  R2 = size (Int)
   @  R3 -> trfm (OS_Trfm)
   @  R4 -> clip (OS_Box)
   @  R5 = flatness (Int)

.set XDrawFile_RenderMapped,0x65540
.set DrawFile_RenderMapped,0x45540
   @Entry
   @  R0 = &8 :OR: flags (DrawFile_RenderFlags)
   @  R1 -> diagram (DrawFile_Diagram)
   @  R2 = size (Int)
   @  R3 -> trfm (OS_Trfm)
   @  R4 -> clip (OS_Box)
   @  R5 = flatness (Int)
   @  R6 -> mapping (OSSpriteOp_ColourMapping)

.set XDrawFile_BBox,0x65541
.set DrawFile_BBox,0x45541
   @Entry
   @  R0 = flags (DrawFile_BBoxFlags)
   @  R1 -> diagram (DrawFile_Diagram)
   @  R2 = size (Int)
   @  R3 -> trfm (OS_Trfm)
   @  R4 = bbox (pointer to OS_Box)

.set XDrawFile_DeclareFonts,0x65542
.set DrawFile_DeclareFonts,0x45542
   @Entry
   @  R0 = flags (DrawFile_DeclareFontsFlags)
   @  R1 -> diagram (DrawFile_Diagram)
   @  R2 = size (Int)

#  define Service_DrawObjectRender 0x45540
   @Entry
   @  R0 = type (DrawFile_Type)
   @  R1 = &45540
   @  R2 = state (pointer to DrawFile_RenderState)
   @Exit
   @  R1 = unclaimed (Bool)

#  define Service_DrawObjectDeclareFonts 0x45541
   @Entry
   @  R0 = type (DrawFile_Type)
   @  R1 = &45541
   @  R2 = state (pointer to DrawFile_DeclareFontsState)
   @Exit
   @  R1 = unclaimed (Bool)

#endif
